package com.baoteng.base.model;

/**
 * Author: loren
 * Date: 2019/9/26
 */
public class BaseResult<T> {

    private static final String RESULT_OK = "0";
    private static final String RESULT_OK2 = "0.0";
    private String code;
    private String error;
    private String msg;
    private T data;

    public String getResultCode() {
        return code;
    }

    public void setResultCode(String resultCode) {
        this.code = resultCode;
    }

    public String getResultMessage() {
        return msg;
    }

    public void setResultMessage(String resultMessage) {
        this.msg = resultMessage;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public boolean isSuccess() {
        if (code != null) {
            return code.equals(RESULT_OK) || code.equals(RESULT_OK2);
        }
        if (error != null) {
            return error.equals(RESULT_OK) || error.equals(RESULT_OK2);
        }
        return false;
    }

}
